In [2]:
import requests
from IPython.display import display, Image
import json
import time

next = ''
posts = []
for i in range(2):
    result = json.loads(
        requests.get('https://api.reddit.com/r/pics', 
                     params={"after": next},
                     headers={'User-Agent': 'Mozilla/5 Data Science Intro'}).text)
    next = result["data"]["after"]
    posts = posts + result["data"]["children"]


posts = [post["data"] for post in posts if post["data"]["url"].endswith("jpg")]
print(len(posts))

for post in posts:
    display(post["url"])
    display(Image(post["url"]))
    print(post["title"])
    print()
    time.sleep(0.5)
42
'https://i.redd.it/7qzcafry4zg01.jpg'
Rice field farmer ~ Thailand

'https://i.redd.it/a1j474l1izg01.jpg'
It really is true...

'https://i.redd.it/32djcqyj0zg01.jpg'
Frodo on the day he was found and now (one eyed and spoiled :)

'https://i.imgur.com/T04gWp3.jpg'
Topical Smirnoff Ad

'https://i.redd.it/xtvjni1twyg01.jpg'
Living in a fairly "white" town in redneck Indiana, it was refreshing to see this dude at Black Panther last night.

'https://i.redd.it/8xnak4s5dzg01.jpg'
IOPub data rate exceeded.
The notebook server will temporarily stop sending output
to the client in order to avoid crashing it.
To change this limit, set the config variable
`--NotebookApp.iopub_data_rate_limit`.
Burnt basement window. Took this while digging through the remains of my parents house after a fire that destroyed their house and killed my dad. But I guess there is beauty everywhere.

'https://i.redd.it/7fd5ybswmyg01.jpg'
IOPub data rate exceeded.
The notebook server will temporarily stop sending output
to the client in order to avoid crashing it.
To change this limit, set the config variable
`--NotebookApp.iopub_data_rate_limit`.
Took a picture from the top of Mt Bromo, Indonesia that I thought you lot might like...

'https://i.redd.it/mkiegucfeyg01.jpg'
The skeleton of a 28ft Anaconda!

'https://i.imgur.com/eawYpWp.jpg'
Tunisian Protester holding A Sign That Says Grow The Brain Before The Beard

'https://i.imgur.com/4TsB4LO.jpg'
Backyard bowling alley, with pins resetting via strings

'https://i.redd.it/yare1yegyvg01.jpg'
Cross section of a hedge

'https://i.redd.it/7wn25p47nwg01.jpg'
Friend of mine who's been living in Japan for the last 16+ years has become a pretty serious amateur photographer. I keep telling him to post on here, it's some amazing shots.

'https://i.redd.it/4gak7p0xdwg01.jpg'
I spotted this at a park while walking the streets of Rome, Italy.

'http://i.redd.it/t574wm2wta8y.jpg'
Can't go wrong with a tux

'https://i.redd.it/xqgr4dstzzg01.jpg'
Grandmother turned 100 yesterday, she wanted Jell-O shots for her toast!

'https://i.imgur.com/eosd9Ft.jpg'
Jacqueline Kiplimo Helps A Disabled Runner Finish A Marathon In Taiwan, Costing Her A First Place Finish

'https://i.redd.it/i7jmxt9spvg01.jpg'
Avenue of the baobabs

'https://i.redd.it/n5fuarsp9vg01.jpg'
My 65-year young mother in her home, this morning.

'https://i.redd.it/90dxdzmkmzg01.jpg'
Presidential Handshake and Respect.

'https://i.redd.it/i3uwsu280xg01.jpg'
Light tree

'https://i.redd.it/xdzhtoqdlug01.jpg'
Our daughter was visited by Maddie, a therapy dog, before her (successful) surgery at Phoenix Children’s Hospital ... this dog helped all of us more than she will ever know ... she’s not a good girl, she’s a great girl

'https://i.imgur.com/z3kN2jog.jpg'
Embedding Architecture with Nature

'https://i.imgur.com/IbOUQNU.jpg'
Pizza Planet

'https://i.redd.it/n41rxdenpug01.jpg'
I was wandering through Rome tonight and stumbled upon this majestic human being!

'https://i.redd.it/klb9ux7myzg01.jpg'
This is Sparta, the very fist post I saw, fell in love with reddit at first sight

'https://i.redd.it/rhglhwml0ug01.jpg'
It was a rainy evening and I had this beautiful bridge all to myself

'https://i.redd.it/kodh2e30ytg01.jpg'
Budget Harry Potter cast

'https://i.imgur.com/WheJh3y.jpg'
Waffles for breakfast in Belgium

'https://i.redd.it/4a18ik2ws0h01.jpg'
1 year

'https://i.redd.it/kt1q6kmeizg01.jpg'
IOPub data rate exceeded.
The notebook server will temporarily stop sending output
to the client in order to avoid crashing it.
To change this limit, set the config variable
`--NotebookApp.iopub_data_rate_limit`.
Triple core Falcon Heavy at liftoff from my remote camera 1300ft away - Caught the "rain birds" in action lower right

'https://i.redd.it/pw8mcie1z0h01.jpg'
I just rode with the highest rated Uber driver in NYC! Mustapha speaks four languages, studies computer programming at night at community college, has driven over 10,000 people, and has a rating of 4.96. Truly one of the nicest most inspiring people out there.

'https://i.redd.it/qok7l0as10h01.jpg'
This photo of my ‘anti-paparazzi’ jacket taken in broad daylight

'https://i.redd.it/r6j4kkegztg01.jpg'
Window washers at a children's hospital.

'https://i.redd.it/dor6ffb2b0h01.jpg'
a miniature cow

'https://i.imgur.com/GMHOAlF.jpg'
Legend says it still has full battery

'https://i.redd.it/lp1kyrs16zg01.jpg'
When HTML Is Your Life

'https://i.redd.it/ghedos9flug01.jpg'
Guns or Life? Man silently protesting in front of the Lincoln Memorial today.

'https://i.imgur.com/Zi37nXC.jpg'
I'm vacationing in Cambodia, here's my hotel at sunset

'https://i.redd.it/u90mtto7q0h01.jpg'
This is just beautiful

'https://i.redd.it/vyngvz12gzg01.jpg'
My Mum saving a turtle we found entangled in netting off the coast of Madeira in ‘99 - hopefully he’s still out there....

'https://i.redd.it/6k2n8a79tsg01.jpg'
Bolaji Badejo, the 7'3" actor that played the title role in Alien

'https://i.redd.it/g3sizx2140h01.jpg'
Surreal shot and edit I did with the help of a friend!